// DevDlg.cpp : implementation file
//

#include "stdafx.h"
#include "attendance.h"
#include "DevDlg.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CDevDlg dialog


CDevDlg::CDevDlg(CWnd* pParent /*=NULL*/)
	: CDialog(CDevDlg::IDD, pParent)
{
	//{{AFX_DATA_INIT(CDevDlg)
		// NOTE: the ClassWizard will add member initialization here
	m_firstVal = 192;
	m_secondVal = 168;
	m_thirdVal = 1;
	m_forthVal = 101;
	//}}AFX_DATA_INIT
}


void CDevDlg::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CDevDlg)
	DDX_Control(pDX, IDC_IPADDRESS1, m_IPCtrl);
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(CDevDlg, CDialog)
	//{{AFX_MSG_MAP(CDevDlg)
	ON_NOTIFY(IPN_FIELDCHANGED, IDC_IPADDRESS1, OnFieldchangedIpaddress1)
	ON_BN_CLICKED(IDC_BTN_MOD, OnBtnMod)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CDevDlg message handlers

BOOL CDevDlg::OnInitDialog() 
{
	CDialog::OnInitDialog();
	
	// TODO: Add extra initialization here
	m_IPCtrl.SetAddress(m_firstVal,m_secondVal,m_thirdVal,m_forthVal);
	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}

void CDevDlg::OnFieldchangedIpaddress1(NMHDR* pNMHDR, LRESULT* pResult) 
{
	// TODO: Add your control notification handler code here
	DWORD dwIPAddress;
	m_IPCtrl.GetAddress(dwIPAddress);

	UpdateData(FALSE);
	m_firstVal = HIBYTE(HIWORD(dwIPAddress));
	m_secondVal = LOBYTE(HIWORD(dwIPAddress));
	m_thirdVal= HIBYTE(LOWORD(dwIPAddress));
	m_forthVal = LOBYTE(LOWORD(dwIPAddress));

	*pResult = 0;
}

void CDevDlg::OnBtnMod() 
{
	// TODO: Add your control notification handler code here
	CDevDlg::OnOK();
}
